<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="vue.js"></script>
  <style>
    .box{
      width:100px;
      height:100px;
      background: rgb(212, 209, 35);
      margin-top:300px;
      margin-left:50px;
    }
    .fade-enter{
      transform:translateY(-400px) rotate(-360deg);
      opacity: 0;
    }
  
    .fade-leave-to{
      transform: translate(800px) rotate(360deg);
      opacity: 0;
    }
    .fade-leave-active,.fade-enter-active{
      transition: all 2s;
    }
  </style>
</head>
<body>
  <div id="app">
    <button @click="isShow = !isShow">{{ isShow?'消失':'显示' }}</button>
    <transition name="fade">
      <div class="box" v-if="isShow"></div>
    </transition>
    
  </div>
  <script>
    new Vue({
      el:"#app",
      data:{
        isShow:false
      }
    })
  </script>
</body>
</html>